package com.spring.oaassist.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.codehaus.jackson.map.util.JSONPObject;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Maps;
import com.spera.shopoa.util.ShopOaSessionUtil;
import com.spera.shopoa.util.ShopOaSessionUtil.OaUser;
import com.spring.oaassist.web.requestModel.CourseTextbook;
import com.spring.oaassist.web.service.OaAssistService;
import com.spring.oaassist.web.service.UserClassManageService;
import com.spring.security.core.annotation.OaUserPermission;
import com.spring.security.core.util.ApplicationUtils;
import com.spring.security.web.model.BaseResult;
import com.spring.tools.Result;
import com.sso.api.web.model.Family;
import com.sso.api.web.model.MemberCard;
import com.sso.api.web.model.MemberInfo;

/**
 * 定制开发
 * @author wojunyu
 *
 */
@Controller
@RequestMapping(value = "/assist")
public class OaAssistController {
	@Resource
	private OaAssistService oaAssistService;
	
	@Resource UserClassManageService userClassManageService;
	
	/**
	 * 公共展现界面
	 * @param querydate
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/pubsrc")
    public ModelAndView pubsrc(String pubsrc,HttpServletRequest request){
		Map<String,String> s = new HashMap<String,String>();
		s.put("pubsrc", pubsrc);
		return new ModelAndView("main/pubsrc",s);
    }
	
	/**
	 * 用户详细信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/userinfo")
	public ModelAndView userinfo(String c_user_id,HttpServletRequest request) {
//		ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> retParm = new HashMap<String,Object>();
		if(ApplicationUtils.isNotNull(c_user_id)){
			Map<String,Object> m = new HashMap<String,Object>();
			m.put("c_user_id", c_user_id);
			List<Map<String,Object>> list = oaAssistService.queryUserInfo(m);
			if(list!=null&&list.size()>0){
				retParm = list.get(0);
			}
		}
		
		return new ModelAndView("main/customerInfo/userinfo",retParm);
	}
	
	/**
	 * 排班页面
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/workschedule")
	@RequestMapping(value = "/workschedule")
	public ModelAndView workschedule(HttpServletRequest request) {
		//OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		return new ModelAndView("main/workschedule/workschedule");
	}
	
	@OaUserPermission(value="/assist/userWorkschedule")
	@RequestMapping(value = "/userWorkschedule")
	public ModelAndView userWorkschedule(HttpServletRequest request) {
		//OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		return new ModelAndView("main/workschedule/userWorkschedule");
	}
	
	@OaUserPermission(value="/assist/deptWorkschedule")
	@RequestMapping(value = "/deptWorkschedule")
	public ModelAndView deptWorkschedule(HttpServletRequest request) {
		//OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		return new ModelAndView("main/workschedule/deptWorkschedule");
	}
	
	/**
	 * 课程表页面
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/courseschedule")
	@RequestMapping(value = "/courseschedule")
	public ModelAndView courseschedule(HttpServletRequest request) {
		return new ModelAndView("main/workschedule/courseschedule");
	}
	
	/**********************************排课start**************************************/
	
	/**
	 * 
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/custcourseapply")
	@RequestMapping(value = "/custcourseapply")
	public ModelAndView custcourseapply(HttpServletRequest request) {
		return new ModelAndView("main/workschedule/custcourseapply");
	}
	
	/**
	 * 查询学生
	 */
	@SuppressWarnings({"unchecked", "rawtypes"})
	@RequestMapping(value = "/custCourseApplyUserList")
	@ResponseBody
	public Object custCourseApplyUserList(String page,String rows,
			String class_id,String babyName,String phone,HttpServletRequest request){
		Map<String, Object> retD = new HashMap<String, Object>();
		if(!ApplicationUtils.isNotNull(class_id)&&!ApplicationUtils.isNotNull(babyName)){
			retD.put("total", 0);
	        retD.put("rows", new ArrayList<Map<String,Object>>()); 
			return retD;
		}
	    Map<String, Object> parm = new HashMap<String, Object>();
	    //数据集合
	    List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
	    //班级列表不为空时，查本地
	    if(ApplicationUtils.isNotNull(class_id)){
	    	parm.put("class_id", class_id);
		    parm.put("babyName", babyName);
	    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(rows));
	        list = userClassManageService.classUserList(parm);
	        PageInfo pageObj = new PageInfo(list);
	        retD.put("total", pageObj.getTotal());
	        retD.put("rows", list);
	        return retD;
	    }else{
	    	parm.put("phone", phone);
		    parm.put("babyName", babyName);
	    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(rows));
	        list = userClassManageService.ssoUserList(parm);
	        PageInfo pageObj = new PageInfo(list);
	        retD.put("total", pageObj.getTotal());
	        retD.put("rows", list);
	    	return retD;
	    }
	}
	
	/**********************************排课end****************************************/
	
	@OaUserPermission(value="/assist/workscheduleK")
	@RequestMapping(value = "/workscheduleK")
	public ModelAndView workScheduleK(HttpServletRequest request) {
		return new ModelAndView("main/workschedule/workschedule_k");
	}
	
	/**
	 * 客户基本信息
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/customerinfo")
	@RequestMapping(value = "/customerinfo")
	public ModelAndView customerinfo(HttpServletRequest request) {
		return new ModelAndView("main/customerInfo/infolist");
	}
	
	/**
	 * 会员基本信息
	 * @param request
	 * @return
	 */
	//@OaUserPermission(value="/assist/memberInfo")
	@RequestMapping(value = "/memberInfo")
	public ModelAndView memberInfo(String c_user_id,HttpServletRequest request) {
		if(StringUtils.isEmpty(c_user_id)){
			return new ModelAndView("404");
		}
		Map<String,Object> m = Maps.newHashMap();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/customerInfo/memberinfo",m);
	}
	
	/**
	 * 客户服务记录
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/consumehis")
	@RequestMapping(value = "/consumehis")
	public ModelAndView consumehis(HttpServletRequest request) {
		return new ModelAndView("main/customerInfo/consumehis");
	}
	
	/**
	 * 客户个人空间
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/customerspace")
	@RequestMapping(value = "/customerspace")
	public ModelAndView customerspace(HttpServletRequest request) {
		return new ModelAndView("main/customerInfo/customerspace");
	}
	

	
	
	
	
	@RequestMapping(value = "/m3commentList")
	public ModelAndView m3commentList(String c_user_id,HttpServletRequest request) {
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/adolescedata/m3commentList",m);
	}
	/**
	 * 评论
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/commentList")
	public ModelAndView commentList(String c_user_id,HttpServletRequest request) {
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/adolescedata/commentList",m);
	}
	
	
	@RequestMapping(value = "/queryCommentList")
    @ResponseBody
    public Object queryCommentList(String serviceModuleCode,String date_from,String date_to,String fromUserID,String toUserID,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        //if(ApplicationUtils.isNotNull(t_user_id)){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
        
		toUserID=oaUser.getOa_user_id();
		
        	parm.put("toUserID", toUserID);
        	parm.put("fromUserID", fromUserID);
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
        	parm.put("serviceModuleCode",serviceModuleCode);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryCommentList(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
        //}
        return retD;
    }
	
	
	
	@RequestMapping(value = "/reComment")
    @ResponseBody
    public Object reComment(String parentID, String toUserID, String toUserName, String toUserType,
    		String fromUserID, String fromUserName, String fromUserType, String serviceID, String businessTypeCode, 
    		String serviceModuleCode, String comment,HttpServletRequest request,String callback){
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
        
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		
		if(oaUser!=null){
			fromUserID=oaUser.getOa_user_id();
			fromUserName=oaUser.getOa_user_name();
		}
        
    	Map<String,Object> rt = Maps.newHashMap();
    	try{
    		rt = oaAssistService.reComment(parentID, toUserID, toUserName, 
             		toUserType, fromUserID, fromUserName, fromUserType, serviceID, businessTypeCode, serviceModuleCode, comment);

    	}catch(Exception e){
    		rt.put(ApplicationUtils.STATUS, "0");
    		rt.put(ApplicationUtils.MSG, "系统异常");
    		e.printStackTrace();
    	}
        if(ApplicationUtils.isNotNull(callback)){
        	return new JSONPObject(callback, rt);
        }else{
        	return rt;
        }
    }
	
	
	/**
	 * 文字记录
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/textlist")
	public ModelAndView textlist(String c_user_id,HttpServletRequest request) {
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/adolescedata/textlist",m);
	}
	
	/**
	 * 图片记录
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/photolist")
	public ModelAndView photolist(String c_user_id,HttpServletRequest request) {
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/adolescedata/photolist",m);
	}
	
	/**
	 * 视屏记录
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/videolist")
	public ModelAndView videolist(String c_user_id,HttpServletRequest request) {
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("c_user_id", c_user_id);
		return new ModelAndView("main/adolescedata/videolist",m);
	}
	
	/**
	 * 辅导员建议
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/commontlist")
	public ModelAndView commontlist(HttpServletRequest request) {
		return new ModelAndView("main/adolescedata/commontlist");
	}
	
	/**
	 * 课程与评语
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/classcommont")
	@RequestMapping(value = "/classcommont")
	public ModelAndView classcommont(HttpServletRequest request) {
		return new ModelAndView("main/customerInfo/classcommont");
	}
	
	/**
	 * 游戏课程（早教）
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/courseinfozj")
	@RequestMapping(value = "/courseinfozj")
	public ModelAndView courseinfozj(HttpServletRequest request) {
		return new ModelAndView("main/businessmanage/courseinfo_zj");
	}
	
	/**
	 * 游戏课程（托班）
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/courseinfotb")
	@RequestMapping(value = "/courseinfotb")
	public ModelAndView courseinfotb(HttpServletRequest request) {
		return new ModelAndView("main/businessmanage/courseinfo_tb");
	}
	
	/**
	 * 课程学生
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/coursestudents")
	@RequestMapping(value = "/coursestudents")
	public ModelAndView coursestudents(String course_detail_id,HttpServletRequest request) {
		ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("course_detail_id", course_detail_id);
		return new ModelAndView("main/businessmanage/course_students",m);
	}
	
	/**
	 * 会员消费历史
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/memberconsumehis")
	@RequestMapping(value = "/memberconsumehis")
	public ModelAndView memberconsumehis(HttpServletRequest request) {
		return new ModelAndView("main/businessmanage/memberconsumehis");
	}
	
	/**
	 * 非会员消费历史
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/unmemberconsumehis")
	@RequestMapping(value = "/unmemberconsumehis")
	public ModelAndView unmemberconsumehis(HttpServletRequest request) {
		return new ModelAndView("main/businessmanage/unmemberconsumehis");
	}
	
	/**
	 * 角色菜单
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/rolemenu")
	@RequestMapping(value = "/rolemenu")
	public ModelAndView rolemenu(HttpServletRequest request) {
//		boolean ret = ShopOaSessionUtil.checkOaSession(request);
//		if(ret){
			return new ModelAndView("main/rolemenu/rolemenu");
//		}else{
//			return new ModelAndView("/404");
//		}
	}
	
	/**
	 * 商机提示（入会来源）
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/bizcuebyapplication")
	@RequestMapping(value = "/bizcuebyapplication")
	public ModelAndView bizcuebyapplication(HttpServletRequest request) {
		return new ModelAndView("main/bizcue/byapplication");
	}
	
	/**
	 * 辅导员客户维护模块
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/assistcustomer")
	@RequestMapping(value = "/assistcustomer")
	public ModelAndView assistcustomer(HttpServletRequest request) {
		return new ModelAndView("main/crm/assistcustomer");
	}
	
	
	/**
	 * 乐园商品管理
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/parkProduct")
	@RequestMapping(value = "/parkProduct")
	public ModelAndView parkProduct(HttpServletRequest request) {
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
//		/**
//		 * 旗舰店编号
//		 */
//		String shop_dept_id = oaUser.getUser_shopdept_id();
//		String kids_parkID = "";
//		if(ApplicationUtils.isNotNull(shop_dept_id)){
//			kids_parkID = oaAssistService.queryKidsParkByOaShopId(shop_dept_id);
//		}
		Map<String,Object> retM = new HashMap<String,Object>();
		retM.put("kids_parkID", oaUser.getKids_park_id());
		return new ModelAndView("main/parkinfo/parkproduct",retM);
	}
	
	
	/**
	 * 注册锁定账户
	 * @param request
	 * @return
	 */
	@OaUserPermission(value="/assist/registerbyassist")
	@RequestMapping(value = "/registerbyassist")
	public ModelAndView registerbyassist(HttpServletRequest request) {
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		Map<String,Object> retM = new HashMap<String,Object>();
		retM.put("t_user_id", oaUser.getOa_user_id());
		retM.put("t_username", oaUser.getOa_user_name());
		return new ModelAndView("main/register/byapplication",retM);
	}
	
	/**
	 * 菜单管理
	 * @param request
	 * @return
	 */
//	@RequiresPermissions("oa:menulist")
	@OaUserPermission(value="/assist/menulist")
	@RequestMapping(value = "/menulist")
	public ModelAndView menulist(HttpServletRequest request) {
		return new ModelAndView("main/menu/menulist");
	}
	
	/**
	 * 排班数据
	 * @param querydate
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryScheduler")
    @ResponseBody
    public Object queryScheduler(String userType,String queryDept,String queryUser,String querydate,String queryScheduleType,HttpServletRequest request){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		if(ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
			Map<String, Object> parm = new HashMap<String, Object>();
			//查询自己
			if(StringUtils.isEmpty(userType)){
				parm.put("userId",ApplicationUtils.Object2String(oaUser.getOa_user_id()));
			}
			
			if(!StringUtils.isEmpty(userType)){
				//查询自己部门
				if("dept".equalsIgnoreCase(userType)){
					parm.put("deptId",ApplicationUtils.Object2String(oaUser.getUser_dept_id()));
				}else{
					parm.put("queryDept",queryDept);
					parm.put("queryUser",queryUser);
					parm.put("queryScheduleType",queryScheduleType);
				}
			}
	        List<Map<String,Object>> list = oaAssistService.queryScheduler(parm);
	        return list;
		}else{
			return null;
		}
    }
	
	/**
	 * 课程表数据
	 * @param querydate
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryCourseScheduler")
    @ResponseBody
    public Object queryCourseScheduler(String querydate,HttpServletRequest request){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		if(oaUser!=null&&ApplicationUtils.isNotNull(oaUser.getOa_user_id())&&ApplicationUtils.isNotNull(querydate)){
			Map<String, Object> parm = new HashMap<String, Object>();
			parm.put("kids_parkID",ApplicationUtils.Object2String(oaUser.getKids_park_id()));
			parm.put("month_time",querydate);
	        List<Map<String,Object>> list = oaAssistService.queryCourseScheduler(parm);
	        return list;
		}else{
			return null;
		}
    }
	
	
	/**
	 * 
	 * @param querydate
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryCustCourseApply")
    @ResponseBody
    public Object queryCustCourseApply(String querydate,String c_user_id,String isReleased,HttpServletRequest request){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		if(oaUser!=null&&ApplicationUtils.isNotNull(oaUser.getOa_user_id())&&ApplicationUtils.isNotNull(querydate)){
			Map<String, Object> parm = new HashMap<String, Object>();
			parm.put("kids_parkID",ApplicationUtils.Object2String(oaUser.getKids_park_id()));
			parm.put("month_time",querydate);
			parm.put("c_user_id",c_user_id);
			parm.put("isReleased",isReleased);
	        List<Map<String,Object>> list = oaAssistService.queryCustCourseApply(parm);
	        return list;
		}else{
			return null;
		}
    }
	
	
	/**
	 * 客户基本信息
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryCustomerList")
    @ResponseBody
    public Object queryCustomerList(String member_number,String member_type,
    		String t_user_id,String phone,String userName,
    		String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
        String kids_park_id=oaUser.getKids_park_id();
        
		if(ApplicationUtils.isNotNull(ApplicationUtils.Object2String(oaUser.getOa_user_id()))){
        	parm.put("t_user_id",ApplicationUtils.Object2String(oaUser.getOa_user_id()));
        	parm.put("phone",phone);
        	parm.put("userName",userName);
        	parm.put("kids_park_id",kids_park_id);
        	parm.put("member_number",member_number);
        	parm.put("member_type",member_type);
        	
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            
            List<Map<String, Object>> list = oaAssistService.queryCustomerList(parm);
            PageInfo pageObj = new PageInfo(list);
            List<MemberInfo> listData = oaAssistService.checkMemberList(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", listData);
            return retD;
		}else{
			return null;
		}
    }
	
	@RequestMapping(value = "/updateUser")
    @ResponseBody
    public Object updateUser(String cid,String nickname,String englishName,HttpServletRequest request) throws Exception{
		ShopOaSessionUtil.setOaSession(request);
		return oaAssistService.updateUser(cid,nickname,englishName,request);
	}

	/**
	 * 客户服务信息
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryCustomerServerList")
    @ResponseBody
    public Object queryCustomerServerList(String baby_name,String phone,String date_from,String date_to,String t_user_id,
    		String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		if(ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
        	//parm.put("t_user_id",oaUser.getOa_user_id());
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
        	parm.put("kids_parkID",oaUser.getKids_park_id());
        	parm.put("baby_name",baby_name);
        	parm.put("phone",phone);
        	//parm.put("userName",userName);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryCustomerServerList(parm);
            PageInfo pageObj = new PageInfo(list);
            List<Map<String,Object>> listData = oaAssistService.checkCustomerServerList(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", listData);
            return retD;
		}else{
			return null;
		}
    }
	
	/**
	 * 查询客户个人空间
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryCustomerSpace")
    @ResponseBody
    public Object queryCustomerSpace(String isMember,String t_user_id,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
        
		if(ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
        	parm.put("t_user_id",oaUser.getOa_user_id());
        	parm.put("isMember",isMember);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryCustomerSpace(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
            return retD;
		}else{
			return null;
		}
    }
	
	/**
	 * 查询课程与评语
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryClassCommont")
    @ResponseBody
    public Object queryClassCommont(String date_from,String date_to,String t_user_id,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
        
		if(ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
        	parm.put("t_user_id",oaUser.getOa_user_id());
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryClassCommont(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
            return retD;
		}else{
			return null;
		}
    }
	
	/**
	 * 会员照片
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryTextList")
    @ResponseBody
    public Object queryTextList(String date_from,String date_to,String c_user_id,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        //if(ApplicationUtils.isNotNull(t_user_id)){
        	parm.put("user_id", c_user_id);
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryTextList(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
        //}
        return retD;
    }
	
	/**
	 * 会员照片
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryPhotoList")
    @ResponseBody
    public Object queryPhotoList(String date_from,String date_to,String c_user_id,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        //if(ApplicationUtils.isNotNull(t_user_id)){
        	parm.put("user_id", c_user_id);
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryPhotoList(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
        //}
        return retD;
    }
	
	/**
	 * 会员视频
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryVideoList")
    @ResponseBody
    public Object queryVideoList(String date_from,String date_to,String c_user_id,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        //if(ApplicationUtils.isNotNull(t_user_id)){
        	parm.put("user_id", c_user_id);
        	parm.put("date_from",date_from);
        	parm.put("date_to",date_to);
            PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
            List<Map<String,Object>> list = oaAssistService.queryVideoList(parm);
            PageInfo pageObj = new PageInfo(list);
            retD.put("total", pageObj.getTotal());
            retD.put("data", list);
        //}
        return retD;
    }
	
	/**
	 * 早教托班业务数据
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryCourseInfoList")
    @ResponseBody
    public Object queryCourseInfoList(String date_from,String date_to,String course_type_code,
    		String page,String pageSize,HttpServletRequest request){
		if(!ApplicationUtils.isNotNull(course_type_code)){
			return null;
		}
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
    	parm.put("course_type_code",course_type_code);
    	parm.put("date_from",date_from);
    	parm.put("date_to",date_to);
        PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryCourseInfoList(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 课程学生
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryCourseStudentsList")
    @ResponseBody
    public Object queryCourseStudentsList(String course_detail_id,
    		String page,String pageSize,HttpServletRequest request){
		if(!ApplicationUtils.isNotNull(course_detail_id)){
			return null;
		}
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
    	parm.put("course_detail_id",course_detail_id);
        PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryCourseStudentsList(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 交费会员消费历史
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryMemberConsumeHisList")
    @ResponseBody
    public Object queryMemberConsumeHisList(
    		String page,String pageSize,HttpServletRequest request){
//		if(!ApplicationUtils.isNotNull(course_detail_id)){
//			return null;
//		}
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
//    	parm.put("course_detail_id",course_detail_id);
        PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryMemberConsumeHis(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 注册会员消费历史
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryUnMemberConsumeHisList")
    @ResponseBody
    public Object queryUnMemberConsumeHisList(
    		String page,String pageSize,HttpServletRequest request){
//		if(!ApplicationUtils.isNotNull(course_detail_id)){
//			return null;
//		}
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
//    	parm.put("course_detail_id",course_detail_id);
        PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryUnMemberConsumeHis(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 按入会来源查询商机提示
	 * @param querydate
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryBizCueByApplication")
    @ResponseBody
    public Object queryBizCueByApplication(
    		String page,String pageSize,HttpServletRequest request){
//		if(!ApplicationUtils.isNotNull(course_detail_id)){
//			return null;
//		}
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
//    	parm.put("course_detail_id",course_detail_id);
        PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryBizCueByApplication(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 菜单树
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/menuZtree")
    @ResponseBody
    public Object menuZtree(String user_priv_id,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        parm.put("user_priv_id",user_priv_id);
        List<Map<String,Object>> list = oaAssistService.queryMenuZtree(parm);
        return list;
    }
	
	/**
	 * 角色树
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/roleList")
    @ResponseBody
    public Object roleList(HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        List<Map<String,Object>> list = oaAssistService.queryRoleList(parm);
        return list;
    }
	
	/**
	 * 保存角色菜单
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/saveRoleMenu")
    @ResponseBody
    public Object saveRoleMenu(String roleid,String menuids,HttpServletRequest request){
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("msg", "保存失败");
		if(!ApplicationUtils.isNotNull(roleid)||!ApplicationUtils.isNotNull(menuids)){
			ret.put("msg", "缺少参数");
			return ret;
		}
        int isOk = oaAssistService.saveRoleMenu(roleid,menuids);
        if(isOk!=0){
        	ret.put("msg", "保存成功");
        }
        return ret;
    }
	
	/**
	 * 保存菜单
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/saveMenu")
    @ResponseBody
    public Object saveMenu(String id,String pId,String name,String func_url,
    		String func_order,String is_show,HttpServletRequest request){
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("msg", "保存失败");
		if(!ApplicationUtils.isNotNull(name)){
			ret.put("msg", "缺少参数");
			return ret;
		}
        int isOk = oaAssistService.saveMenu(id,pId,name,func_url,func_order,is_show);
        if(isOk!=0){
        	Map<String, Object> parm = new HashMap<String, Object>();
            List<Map<String,Object>> list = oaAssistService.queryMenuZtree(parm);
            ret.put("dataset", list);
        	ret.put("msg", "保存成功");
        }
        return ret;
    }
	
	/**
	 * 删除菜单
	 * @param id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/deleteMenu")
    @ResponseBody
    public Object deleteMenu(String id,HttpServletRequest request){
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("msg", "保存失败");
		if(!ApplicationUtils.isNotNull(id)){
			ret.put("msg", "缺少参数");
			return ret;
		}
        int isOk = oaAssistService.deleteMenu(id);
        if(isOk!=0){
        	Map<String, Object> parm = new HashMap<String, Object>();
            List<Map<String,Object>> list = oaAssistService.queryMenuZtree(parm);
            ret.put("dataset", list);
        	ret.put("msg", "删除成功");
        }
        return ret;
    }
	
	/**
	 * 查询乐园
	 * @param id
	 * @param request
	 * @return
	 */
//	@RequestMapping(value = "/queryPark")
//    @ResponseBody
//    public Object queryPark(String oaDeptId,HttpServletRequest request){
//        Map<String, Object> parm = new HashMap<String, Object>();
//        Map<String, Object> retD = new HashMap<String, Object>();
//    	parm.put("oaDeptId",oaDeptId);
//        List<Map<String,Object>> list = oaAssistService.queryPark(parm);
//        retD.put("data", list);
//        return retD;
//    }
	
	/**
	 * 查询商品（并根据乐园查询乐园是否有该商品）
	 * @param id
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value = "/queryProduct")
    @ResponseBody
    public Object queryProduct(String kids_park_id,String productName,String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
    	parm.put("kids_park_id",kids_park_id);
    	parm.put("productName",productName);
//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryProduct(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	
	/**
	 * 保存乐园商品
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/saveParkProduct")
    @ResponseBody
    public Object saveParkProduct(@RequestBody List<Map<String,Object>> checkedArr,HttpServletRequest request){
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("msg", "保存失败");
		if(!ApplicationUtils.isNotNull(checkedArr)){
			ret.put("msg", "缺少参数");
			return ret;
		}
		try{
			oaAssistService.saveParkProduct(checkedArr);
	        ret.put("msg", "保存成功");
		}catch(Exception e){
			ret.put("msg", "保存失败");
			e.printStackTrace();	
		}
        
        return ret;
    }
	
	/**
	 * 删除关系
	 * @param park_id
	 * @param product_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/removeParkProduct")
    @ResponseBody
    public Object removeParkProduct(String park_id,String product_id,HttpServletRequest request){
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("msg", "操作失败");
		if(StringUtils.isEmpty(park_id)||StringUtils.isEmpty(product_id)){
			ret.put("msg", "缺少参数");
			return ret;
		}
		try{
			oaAssistService.removeParkProduct(park_id, product_id);
	        ret.put("msg", "操作成功");
		}catch(Exception e){
			e.printStackTrace();
			ret.put("msg", "操作失败");
		}
        
        return ret;
    }
	
	/**
	 * SSO客户查询
	 * @param kids_park_id
	 * @param page
	 * @param pageSize
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value = "/querySsoUserInfo")
    @ResponseBody
    public Object querySsoUserInfo(String username,String realname,String phone,
    		String page,String pageSize,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        if(!ApplicationUtils.isNotNull(phone)||phone.length()<5){
        	return null;
        }
    	parm.put("username",username);
    	parm.put("realname",realname);
    	parm.put("phone",phone);
//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.querySsoUserInfo(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 根据辅导员及手机号查询辅导员关联客户
	 * @param username
	 * @param realname
	 * @param phone
	 * @param page
	 * @param pageSize
	 * @param request
	 * @return
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value = "/queryAssistUserInfo")
    @ResponseBody
    public Object queryAssistUserInfo(String birthday,String admission_way_code,String t_user_id,
    		String username,String realname,String phone,
    		String page,String pageSize,HttpServletRequest request){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		
		if(!ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
			return null;
		}
		String assistantId = oaUser.getOa_user_id();
        Map<String, Object> parm = new HashMap<String, Object>();
        Map<String, Object> retD = new HashMap<String, Object>();
        parm.put("assistantId",assistantId);
    	parm.put("username",username);
//    	parm.put("realname",realname);
    	parm.put("phone",phone);
    	
    	parm.put("birthday",birthday);
    	parm.put("admission_way_code",admission_way_code);
//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.queryAssistUserInfo(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("data", list);
        return retD;
    }
	
	/**
	 * 保存辅导员客户关系
	 * @param checkedArr
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/saveAssistUserInfo")
    @ResponseBody
    public Object saveAssistUserInfo(@RequestBody List<Map<String,Object>> checkedArr,HttpServletRequest request){
		Map<String,Object> ret = new HashMap<String,Object>();
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		
		if(ApplicationUtils.isNotNull(oaUser.getOa_user_id())){
			String assistantId = oaUser.getOa_user_id();
			String assistantName = oaUser.getOa_user_name();
			try{
				String sret = oaAssistService.saveAssistUserInfo(assistantId,assistantName,checkedArr);
				ret.put(ApplicationUtils.STATUS, "1");
				if(StringUtils.isEmpty(sret)){
					ret.put(ApplicationUtils.MSG, "保存成功");
				}else{
					ret.put(ApplicationUtils.MSG, sret);
				}
				
	            return ret;
			}catch(Exception e){
				e.getMessage();
				ret.put(ApplicationUtils.STATUS, "0");
				ret.put(ApplicationUtils.MSG, "保存失败");
	            return ret;
			}
		}else{
			ret.put(ApplicationUtils.STATUS, "0");
			ret.put(ApplicationUtils.MSG, "保存失败");
			return ret;
		}
    }
	
	/**
	 * 删除销售顾问客户关系
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/delAssistUserInfo")
    @ResponseBody
    public Object delAssistUserInfo(String c_user_id,HttpServletRequest request){
		Map<String,Object> ret = new HashMap<String,Object>();
		try{
			oaAssistService.delAssistUserInfo(c_user_id);
			ret.put(ApplicationUtils.STATUS, "1");
			ret.put(ApplicationUtils.MSG, "删除成功");
            return ret;
		}catch(Exception e){
			ret.put(ApplicationUtils.STATUS, "0");
			ret.put(ApplicationUtils.MSG, "删除失败");
            return ret;
		}
    }
	
	/**
	 * 根据用户编号查询该用户家庭及家庭成员信息
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryFamilyInfoByUserId")
    @ResponseBody
    public Object queryFamilyInfoByUserId(String c_user_id,HttpServletRequest request){
		if(StringUtils.isEmpty(c_user_id)){
			return null;
		}
		Map<String, Object> parm = Maps.newHashMap();
		parm.put("c_user_id", c_user_id);
		List<Family> familyList = oaAssistService.queryFamilyInfoByUserId(parm);
        return familyList;
    }
	
	/**
	 * 根据用户ID查询用户会员卡信息
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryMemberCardInfo")
    @ResponseBody
    public Object queryMemberCardInfo(String c_user_id,HttpServletRequest request){
		if(StringUtils.isEmpty(c_user_id)){
			return null;
		}
		Map<String, Object> parm = Maps.newHashMap();
		parm.put("c_user_id", c_user_id);
		List<MemberCard> familyList = oaAssistService.queryMemberCardInfo(parm);
        return familyList;
    }
	
	/**
	 * 查询用户信息
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryUserInfo")
    @ResponseBody
    public Object queryUserInfo(String c_user_id,HttpServletRequest request){
		if(StringUtils.isEmpty(c_user_id)){
			return null;
		}
		Map<String, Object> parm = Maps.newHashMap();
		parm.put("c_user_id", c_user_id);
		List<Map<String, Object>> familyList = oaAssistService.queryUserInfo(parm);
        return familyList;
    }
	
	/**
	 * 保存排班信息
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/saveWorkSchedule")
    @ResponseBody
    public Object saveWorkSchedule(@RequestBody Map<String,Object> data,HttpServletRequest request){
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		Result retVal = new Result();
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("dept")))){
			retVal.setStatus("0");
			retVal.setMsg("部门不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("assist")))){
			retVal.setStatus("0");
			retVal.setMsg("人员不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("deptname")))){
			retVal.setStatus("0");
			retVal.setMsg("部门不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("assistname")))){
			retVal.setStatus("0");
			retVal.setMsg("人员不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("title")))){
			retVal.setStatus("0");
			retVal.setMsg("标题不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("content")))){
			retVal.setStatus("0");
			retVal.setMsg("内容不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("scheduleType")))){
			retVal.setStatus("0");
			retVal.setMsg("类型不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("starttime")))){
			retVal.setStatus("0");
			retVal.setMsg("开始时间不能为空");	
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(data.get("endtime")))){
			retVal.setStatus("0");
			retVal.setMsg("结束时间不能为空");
			return retVal;
		}
		
		String[] assistArr = (ApplicationUtils.Object2String(data.get("assist"))).split(",");
		String[] assistNameArr = (ApplicationUtils.Object2String(data.get("assistname"))).split(",");
		int ret = 0;
		for(int i=0;i<assistArr.length;i++){
			if(assistArr[i]!=null&&!assistArr[i].equals("")){
				data.put("id", ApplicationUtils.randomUUID());
				data.put("assist", assistArr[i]);
				data.put("assistname", assistNameArr[i]);
				data.put("operId", oaUser.getOa_user_id());
				data.put("operName", oaUser.getOa_user_name());
				int retOne = oaAssistService.saveWorkSchedule(data);
				ret += retOne;
			}
		}
		
		if(ret>0){
			retVal.setStatus("1");
			retVal.setMsg("保存成功");
		}else{
			retVal.setStatus("0");
			retVal.setMsg("保存失败");
		}
        return retVal;
    }
	
	@RequestMapping(value = "/deleteWorkSchedule")
    @ResponseBody
    public Object deleteWorkSchedule(String id){
		BaseResult br=null;
		int effect=oaAssistService.deleteScheduleByID(id);
		if(effect<1){
			br=new BaseResult("0","删除失败");
		}else{
			br=new BaseResult("1","删除成功");
		}
		return br;
	}
	
	@RequestMapping(value = "/copyWorkSchedule")
    @ResponseBody
    public Object copyWorkSchedule(String fromTime,String toTime){
		BaseResult br=null;
    	try{
    		br=oaAssistService.copyWorkSchedule(fromTime,toTime);
    	}catch(Exception e){
    		br=new BaseResult("0","系统异常");
    	}
		return br;
	}
	
	/**
	 * 更新排班信息
	 * @param c_user_id
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/updateWorkSchedule")
    @ResponseBody
    public Object updateWorkSchedule(@RequestBody Map<String,Object> Data,HttpServletRequest request){
		Result retVal = new Result();
		if(StringUtils.isEmpty(Data.get("id"))){
			retVal.setStatus("0");
			retVal.setMsg("主键不能为空");
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("dept")))){
			retVal.setStatus("0");
			retVal.setMsg("部门不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("assist")))){
			retVal.setStatus("0");
			retVal.setMsg("人员不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("deptname")))){
			retVal.setStatus("0");
			retVal.setMsg("部门不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("assistname")))){
			retVal.setStatus("0");
			retVal.setMsg("人员不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("title")))){
			retVal.setStatus("0");
			retVal.setMsg("标题不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("content")))){
			retVal.setStatus("0");
			retVal.setMsg("内容不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("scheduleType")))){
			retVal.setStatus("0");
			retVal.setMsg("类型不能为空");
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("starttime")))){
			retVal.setStatus("0");
			retVal.setMsg("开始时间不能为空");	
			return retVal;
		}
		if(StringUtils.isEmpty(ApplicationUtils.Object2String(Data.get("endtime")))){
			retVal.setStatus("0");
			retVal.setMsg("结束时间不能为空");
			return retVal;
		}
		int ret = oaAssistService.updateWorkSchedule(Data);
		if(ret==1){
			retVal.setStatus("1");
			retVal.setMsg("修改成功");
		}else{
			retVal.setStatus("0");
			retVal.setMsg("修改失败");
		}
        return retVal;
    }
	
	@RequestMapping(value = "/commentPhone")
    @ResponseBody
    public Object commentPhone(String comment, String course_image_id,String callback,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
        
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		
		String c_user_id=oaUser.getOa_user_id();
		String user_name=oaUser.getOa_user_name();
		
    	Map<String,Object> rt = Maps.newHashMap();
    	try{
    		rt = oaAssistService.commentPhone(comment, course_image_id, c_user_id, user_name);

    	}catch(Exception e){
    		rt.put(ApplicationUtils.STATUS, "0");
    		rt.put(ApplicationUtils.MSG, "系统异常");
    		e.printStackTrace();
    	}
        if(ApplicationUtils.isNotNull(callback)){
        	return new JSONPObject(callback, rt);
        }else{
        	return rt;
        }
    }
	

	@RequestMapping(value = "/photoCommentList")
	public ModelAndView photoCommentList(String course_image_id,HttpServletRequest request) {
		ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("course_image_id", course_image_id);
		return new ModelAndView("main/adolescedata/photoCommentList",m);
	}
	
	
	@RequestMapping(value = "/getPhoneComment")
    @ResponseBody
    public Object getPhoneComment(String page,String pageSize, String course_image_id,String callback,HttpServletRequest request) throws Exception{
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
        
        

        Map<String, Object> rt = new HashMap<String, Object>();

//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.getPhoneComment(course_image_id);
        PageInfo pageObj = new PageInfo(list);
        rt.put("total", pageObj.getTotal());
        rt.put("data", list);
        return rt;
   
    }
	
	@RequestMapping(value = "/videocomment")
	public ModelAndView videocomment(String videoID,HttpServletRequest request) {
		ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("videoID", videoID);
		return new ModelAndView("main/adolescedata/videocommentList",m);
	}
	
	
	
	@RequestMapping(value = "/getVideoComment")
    @ResponseBody
    public Object getVideoComment(String page,String pageSize, String videoID,String callback,HttpServletRequest request) throws Exception{
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
        

        Map<String, Object> rt = new HashMap<String, Object>();

//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.getVideoComment(videoID);
        PageInfo pageObj = new PageInfo(list);
        rt.put("total", pageObj.getTotal());
        rt.put("data", list);
        return rt;
   
    }
	
	

	@RequestMapping(value = "/commentVideo")
    @ResponseBody
    public Object commentVideo(String comment, String videoID,String callback,HttpServletRequest request){
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
        
		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
		
		String t_user_id=oaUser.getOa_user_id();
		//String user_name=oaUser.getOa_user_name();
		
    	Map<String,Object> rt = Maps.newHashMap();
    	try{
    		rt = oaAssistService.commentVideo(comment, videoID, t_user_id);

    	}catch(Exception e){
    		rt.put(ApplicationUtils.STATUS, "0");
    		rt.put(ApplicationUtils.MSG, "系统异常");
    		e.printStackTrace();
    	}
        if(ApplicationUtils.isNotNull(callback)){
        	return new JSONPObject(callback, rt);
        }else{
        	return rt;
        }
    }
	
	@RequestMapping(value = "/productList")
	public ModelAndView productList(HttpServletRequest request) {
	//	ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		
		return new ModelAndView("consumeBackground/productList2",m);
	}
	
	@RequestMapping(value = "/productList2")
	public ModelAndView productList2(HttpServletRequest request) {
	//	ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		
		return new ModelAndView("consumeBackground/productList",m);
	}
	
	@RequestMapping(value = "/getVideoComment2")
    @ResponseBody
    public Object getVideoComment2(String page,String pageSize, String videoID,String callback,HttpServletRequest request) throws Exception{
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();
    	OaUser oaUser = ShopOaSessionUtil.getOaUser(request);

        Map<String, Object> rt = new HashMap<String, Object>();

//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<Map<String,Object>> list = oaAssistService.getVideoComment(videoID);
        PageInfo pageObj = new PageInfo(list);
        rt.put("total", pageObj.getTotal());
        rt.put("data", list);
        return rt;
   
    }
	
	@RequestMapping(value = "/usersList")
	public ModelAndView usersList(HttpServletRequest request) {
	//	ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		
		return new ModelAndView("main/business/usersList",m);
	}
	
	@RequestMapping(value = "/getUsersList")
    @ResponseBody
    public Object getUsersList(String page,String pageSize, String c_user_id,String phone,
    		String real_name,String identity_card,String callback,HttpServletRequest request) throws Exception{
        Map<String, Object> parm = new HashMap<String, Object>();
    //    Map<String, Object> retD = new HashMap<String, Object>();

        Map<String, Object> rt = new HashMap<String, Object>();

//    	parm.put("kids_park_id", "51c7325f-3c91-484f-85d0-1feecef70116");
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(pageSize));
        List<HashMap<String,Object>> list = oaAssistService.getUsersList(c_user_id, phone, real_name, identity_card);
        PageInfo pageObj = new PageInfo(list);
        rt.put("total", pageObj.getTotal());
        rt.put("data", list);
        return rt;
   
    }
	

	@RequestMapping(value = "/getBabyList")
	@ResponseBody
	public Object getBabyList(String skip,
			String take ,String real_name,String name,String phone,String callback) {

		Map<String, Object> m = new HashMap<String, Object>();
		try {

			m = oaAssistService.getBabyList(skip, take, real_name,phone);
					
		} catch (Exception e) {
			m.put(ApplicationUtils.STATUS, "0");
			m.put(ApplicationUtils.MSG, "系统异常");
			e.printStackTrace();

		}

		if (ApplicationUtils.isNotNull(callback)) {
			return new JSONPObject(callback, m);
		} else {
			return m;
		}
	}
			
			
	
	
	@RequestMapping(value = "/avatar")
	public ModelAndView avatar(HttpServletRequest request) {
	//	ShopOaSessionUtil.checkOaSession(request);
		Map<String,Object> m = new HashMap<String,Object>();
		
		return new ModelAndView("main/business/avatar",m);
	}
	
	
	@RequestMapping(value = "/addPhoto")
    @ResponseBody
    public Object addPhoto(String formImgData, String c_user_id,String callback,HttpServletRequest request){		
		ShopOaSessionUtil.setOaSession(request);
		Map<String,Object> rt = Maps.newHashMap();
    	try{    		
    		rt=oaAssistService.addPhoto(formImgData, c_user_id,request);
    	}catch(Exception e){
    		rt.put(ApplicationUtils.STATUS, "0");
    		rt.put(ApplicationUtils.MSG, "系统异常");
    		e.printStackTrace();
    	}
        if(ApplicationUtils.isNotNull(callback)){
        	return new JSONPObject(callback, rt);
        }else{
        	return rt;
        }
    }
	
	//easyUIdemo
	@RequestMapping(value = "/myeasyuidemo")
	public ModelAndView myeasyuidemo(HttpServletRequest request){
		return new ModelAndView("main/parkinfo/myeasyuidemo");
	}
	
	@RequestMapping(value = "/test01")
	public ModelAndView test01(HttpServletRequest request){
		return new ModelAndView("main/parkinfo/test01");
	}
	
	@RequestMapping(value = "/fileUpload")
	public ModelAndView fileUpload(HttpServletRequest request){
		return new ModelAndView("main/parkinfo/fileUpload");
	}
	
	@RequestMapping(value = "/fileUpload2")
	public ModelAndView fileUpload2(HttpServletRequest request){
		return new ModelAndView("main/parkinfo/fileUpload2");
	}
	
	@RequestMapping(value = "/uploadify.swf")
	public ModelAndView uploadify(HttpServletRequest request){
		return new ModelAndView("main/parkinfo/uploadify");
	}
	
	
	@RequestMapping(value = "/queryCourseTextbook")
	@ResponseBody
	public Object queryCourseTextbook(String page,String rows,HttpServletRequest request){
	    Map<String, Object> parm = new HashMap<String, Object>();
	    Map<String, Object> retD = new HashMap<String, Object>();
	    
	    System.out.println(page+""+rows);
	    
    	PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(rows));
        List<Map<String,Object>> list = oaAssistService.queryCourseTextbook(parm);
        PageInfo pageObj = new PageInfo(list);
        retD.put("total", pageObj.getTotal());
        retD.put("rows", list); 	
	    return retD;
	}
	
	@RequestMapping(value = "/getBookDate")
	@ResponseBody
	public Object getBookDate(String id,HttpServletRequest request){
		System.out.println(id);
		
		HashMap<String,Object> hm=new HashMap<String,Object>();

		hm.put("publication_date", "2015-07-06");
		
		List list=new ArrayList();
		list.add(hm);
				
	    return list;
	}
	
	
	
	
	
	@RequestMapping(value = "/deleteCourseTextbook")
    @ResponseBody
    public Object deleteCourseTextbook(String ids,HttpServletRequest request){
        BaseResult br=null;		
    	try{    		   		
    		br=oaAssistService.deleteCourseTextbook(ids);    		
    	}catch(Exception e){
    		br=new BaseResult("0","系统异常");
    		e.printStackTrace();
    	}
        	return br;
    }

	@RequestMapping(value = "/saveOrUpdateCourseTextbook")
    @ResponseBody
    public Object saveOrUpdateCourseTextbook(CourseTextbook courseTextbook,HttpServletRequest request){
        BaseResult br=null;		
    	try{    		
			br=oaAssistService.saveOrUpdateCourseTextbook(courseTextbook);   		
    	}catch(Exception e){
    		br=new BaseResult("0","系统异常");
    		e.printStackTrace();
    	}
        	return br;
    }
	
	
	@RequestMapping(value = "/addUsers")
	public ModelAndView addUsers(HttpServletRequest request){
		return new ModelAndView("main/business/addUsers");
	}
		
	@RequestMapping(value = "/addUsersSubmit")
    @ResponseBody
    public Object addUsersSubmit(MultipartFile users,HttpServletRequest request){
        BaseResult br=null;		  	        
    	try{    		   		
    		br=oaAssistService.addUsers(users, request)  ; 		
    	}catch(Exception e){
    		br=new BaseResult("0","系统异常");
    		e.printStackTrace();
    	}
        	return br;        
    }

}
